package com.ysd.lis.controller.pub;

import cn.hutool.json.JSONUtil;
import com.ysd.lis.entity.SysUser;
import com.ysd.lis.service.SysUserService;
import com.ysd.util.RedisUserManager;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;

public class BaseController {
    @Autowired
    SysUserService sysUserService;
    public String  getNowLoadPeople(){
        SysUser user = RedisUserManager.getUser();
        Assert.notNull(user, "SysUser cannot be empty");
        return user.getId();
    }
    public SysUser getLoginUser(){
        return sysUserService.getById(JSONUtil.toJsonStr(SecurityUtils.getSubject().getPrincipal()));
    }
}
